<template>
  <scroll-view scroll-y="true" class="distributionCenter">
    <view class="header">
      <view class="user">
        <img
          class="avatar"
          :src="privacyData.avatarUrl || 'https://talentsupload.oss-cn-beijing.aliyuncs.com/miniprogram/avatar1.png'"
        />
        <view class="flex">
          <view class="nickname">{{info.userName}}</view>
          <view class="font-size-24 color-666 margin-t-ten">分销商等级：{{info.agentName}}</view>
          <view class="font-size-24 color-666 margin-t-ten">佣金比例：直推 {{info.primaryCommissionRatio}}% 间推：{{info.secondaryCommissionRatio}}%</view>
          <!-- <view class="flex-row-align-center">
            <p class="nickname">{{ info.userName }}</p>
            <p class="level">Lv.{{ info.agentName }}</p>
          </view> -->
          <!-- <view class="flex-row-align-center margin-t-ten" @tap="handleShare">
            <view class="phone flex">{{ info.phone }}</view>
            <view class="to-user-info flex-row-center">
              <view>邀好友享收益</view>
              <img
                class="qr-code-img"
                src="https://talentsupload.oss-cn-beijing.aliyuncs.com/miniprogram/distribution/qrCode.png"
              />
              <img
                class="arrow-white-right"
                src="https://talentsupload.oss-cn-beijing.aliyuncs.com/miniprogram/common/backBlack.png"
              />
            </view>
          </view> -->
        </view>
      </view>
    </view>
    <view class="card bg-white">
      <block v-for="(item, index) in distributionData" :key="index">
        <view class="flex-row-center">
          <view
            class="card-item flex-column-center flex"
            :data-page-url="item.pageUrl"
            :data-index="index"
            @tap="onTapDistributionItem"
          >
            <view class="card-item-title">{{ item.title }}</view>
            <view class="card-item-num theme-color" v-if="index == 0">
              {{ (info.dayrevenue || 0).toFixed(2) }}
            </view>
            <view class="card-item-num" v-else-if="index == 1">
              {{ (info.grossCommission || 0).toFixed(2) }}
            </view>
            <view class="card-item-num" v-else-if="index == 2">
              {{ (info.canWithdrawnCommission || 0).toFixed(2) }}
            </view>
            <view class="card-item-num" v-else-if="index == 3">
              {{ (info.withdrawnCommission || 0).toFixed(2) }}
            </view>
            <view class="card-item-num" v-else-if="index == 4">
              {{ (info.teamTotalCommission || 0).toFixed(2) }}
            </view>
            <view class="card-item-num" v-else-if="index == 5">
              {{ info.teamrevenue || 0}}
            </view>
          </view>
          <view class="divider" v-if="(index + 1) % 3 != 0"></view>
        </view>
      </block>
    </view>
    <view class="tabs">
      <block v-for="(tab, index) in tabs" :key="index">
        <view class="tabs-item" @tap="handleTab" :data-index="index">
          <view
            :class="activeTab == index ? 'tab-title-active' : 'tab-title'"
            >{{ tab }}</view
          >
          <view class="tab-indicator" v-if="activeTab == index"></view>
        </view>
      </block>
    </view>
    <swiper :current="activeTab" class="swiper">
      <swiper-item class="swiper-item">
        <!-- <custom-emptyMsg 
          :showIcon="false"
        /> -->
        <!-- <scroll-view :scroll-y="true" @refresherrefresh="onRefresh" :refresher-enabled="true">
          <DistributionOrderItem/>
        </scroll-view> -->
        <DistributionOrderItem/>
      </swiper-item>
      <swiper-item class="swiper-item">
        <!-- <custom-emptyMsg 
          :showIcon="false"
        /> -->
        <DistributionOrderItem/>
        <!-- <DistributionOrderItem :list="distributionOrders"/> -->
      </swiper-item>
      <swiper-item class="swiper-item">
        <UserList />
        <!-- <DistributionOrderItem :list="distributionOrders"/> -->
      </swiper-item>
    </swiper>
  </scroll-view>
</template>

<script src="./indexMod.js">
</script>
<style src="./indexStyle.scss" lang="scss" scoped></style>